package com.mysql.services;

import com.mysql.entity.DataSourceTypeManager;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * Created by swipal on 2017/5/20.
 * 定义 ThreadLocalRountingDataSource，继承AbstractRoutingDataSource：
 */
public class ThreadLocalRountingDataSource extends AbstractRoutingDataSource {
    @Override
    protected Object determineCurrentLookupKey() {
        return DataSourceTypeManager.get();
    }
}
